#
#2008 Julka Lipkova
#

import pygtk
pygtk.require('2.0')
import gtk

from glyphdb import glyphDB

class WholeGlyphBg ( ):
    def __init__(self, id):
        self.lineList = glyphDB.getLinesByID(id)

    def on_expose( self, event, context, dArea ):
        context.set_line_width(2);
        context.set_source_rgba( 0.4, 0.4, 0.4, 0.8 );
        
        if (len(self.lineList)>0):
            context.translate( 0, dArea.baseLineY )
            for l in self.lineList:
                # line with more points
                if (len(l)>1):
                    context.set_line_width(1)
                    context.move_to(l[0][0], l[0][1])
                    for x,y in l[1:]:
                        context.line_to(x, y)
                    context.stroke()
                # only one point line
                elif (len(l)==1):
                    x,y = l[0]
                    # TODO PI
                    context.arc(x, y, 0.8, 0.0, 2.0 * 3.14)
                    context.set_line_width(0)
                    context.fill()

        context.stroke()

# vim: set ts=4 sw=4 sts=4 et :
